package event

import (
	"api/app/wms/auto/v1/mc"
	"api/app/wms/models"
	"context"
	"gitee.com/dreamwood/ez"
)

func init() {
	ez.ListenJoin(mc.ItemMainEventAfterSave, func(v interface{}, ctx context.Context) {
		md, ok := v.(*models.ItemMain)
		if ok {
			md.Read([]string{"Item"})
			md.SkuText = md.Item.Text
			md.SkuCode = md.Item.Code
			md.Save()
		}
	})
}
